home *** CD-ROM | disk | FTP | other *** search
/ Celestin Apprentice 5 / Apprentice-Release5.iso / Information / CSMP Digest / volume 2 / csmp-v2-003.txt < prev    next >
Text File  |  1995-06-30  |  59KB  |  1,733 lines

  1. C.S.M.P. Digest             Mon, 11 Jan 93       Volume 2 : Issue 3
  2.  
  3. Today's Topics:
  4.  
  5.     need Sys6 InForeground() technique
  6.     In search of SYNCHING code
  7.     pbhopendf returns -50?
  8.     TCL: What Are They Trying to Say?
  9.     'appe' File Type
  10.     Just for you, an early Christmas present
  11.     Adding Comm to an Application
  12.  
  13.  
  14.  
  15. The Comp.Sys.Mac.Programmer Digest is moderated by Michael A. Kelly.
  16.  
  17. The digest is a collection of article threads from the internet newsgroup
  18. comp.sys.mac.programmer.  It is designed for people who read c.s.m.p. semi-
  19. regularly and want an archive of the discussions.  If you don't know what a
  20. newsgroup is, you probably don't have access to it.  Ask your systems
  21. administrator(s) for details.  If you don't have access to news, there is
  22. no way that I know of for you to post articles to the group.
  23.  
  24. Each issue of the digest contains one or more sets of articles (called
  25. threads), with each set corresponding to a 'discussion' of a particular
  26. subject.  The articles are not edited; all articles included in this digest
  27. are in their original posted form (as received by our news server at
  28. cs.uoregon.edu).  Article threads are not added to the digest until the last
  29. article added to the thread is at least one month old (this is to ensure that
  30. the thread is dead before adding it to the digest).  Article threads that
  31. consist of only one message are generally not included in the digest.
  32.  
  33. The entire digest is available for anonymous ftp from ftp.cs.uoregon.edu
  34. [128.223.8.8] in the directory /pub/mac/csmp-digest.  Be sure to read the
  35. file /pub/mac/csmp-digest/README before downloading any files.  The most
  36. recent issues are available from sumex-aim.stanford.edu [36.44.0.6] in the
  37. directory /info-mac/digest/csmp.  If you don't have ftp capability, the sumex
  38. archive has a mail server; send a message with the text '$MACarch help' (no
  39. quotes) to LISTSERV@ricevm1.rice.edu for more information.
  40.  
  41. The digest is also available via email.  Just send a note saying that you
  42. want to be on the digest mailing list to mkelly@cs.uoregon.edu, and you will
  43. automatically receive each new issue as it is created.  Sorry, back issues
  44. are not available through the mailing list.
  45.  
  46. Send administrative mail to mkelly@cs.uoregon.edu.
  47.  
  48.  
  49. -------------------------------------------------------
  50.  
  51. From: kjh+@cs.cmu.edu (Kenneth Hughes)
  52. Subject: need Sys6 InForeground() technique
  53. Organization: School of Computer Science, Carnegie Mellon
  54. Date: Mon, 7 Dec 1992 23:23:31 GMT
  55.  
  56. I'm running the attached routine within a trap patch to determine if the
  57. current application is the front application.  It's time to make the code
  58. work under System 6, so I need a technique for determining this without the
  59. benefit of System 7's Process Manager routines.  Note that I cannot use the
  60. usual approach of maintaining a gInForeground variable by toggling it as the
  61. suspend/resume events come in since I'm in a patch, not my own application.
  62. I need to handle apps that may not handle suspend/resumes themselves.  
  63.     What's the best way to do this?  I have a feeling that it's necessarily
  64. messy.  Although I'd prefer a clean solution, I'm not proud.  :-)
  65.  
  66. Boolean
  67. InForeground(void)
  68. {
  69.     ProcessSerialNumber    curPSN,frontPSN;
  70.     long                   response;
  71.     Boolean                inForeground;
  72.     
  73.     if ((TrapAvailable( _GestaltDispatch)) &&
  74.         (Gestalt(gestaltOSAttr, &response) == noErr) &&
  75.         (response && gestaltLaunchControl) ) {
  76.         
  77.         (void) GetCurrentProcess(&curPSN);        // Always returns noErr
  78.         switch(GetFrontProcess(&frontPSN)) {
  79.             case noErr:
  80.                 if (SameProcess(&curPSN,&frontPSN,&inForeground) == noErr)
  81.                     return(inForeground);
  82.                 break;
  83.             case paramErr:
  84.             case procNotFound:
  85.                 break;
  86.             default:
  87.                 DebugStr("\pUnexpected value returned from GetFrontProcess.");
  88.         }  // change "switch" to "if" later.
  89.         return(FALSE);
  90.     } else {
  91.         //
  92.         //
  93.         DebugStr("\pHow can we tell if we're in the foreground under Sys 6?");
  94.         // 
  95.         //
  96.     }
  97. }
  98. Thanks for any help.
  99.  
  100. Kenneth J. Hughes
  101. Entelechy Corporation
  102.  
  103. +++++++++++++++++++++++++++
  104.  
  105. From: wysocki@netcom.com (Chris Wysocki)
  106. Date: 8 Dec 92 17:59:40 GMT
  107. Organization: Connectix Corporation, San Mateo, CA
  108.  
  109. In article <BywwzF.991.1@cs.cmu.edu> kjh+@cs.cmu.edu (Kenneth Hughes) writes:
  110.  
  111. >I'm running the attached routine within a trap patch to determine if the
  112. >current application is the front application.  It's time to make the code
  113. >work under System 6, so I need a technique for determining this without the
  114. >benefit of System 7's Process Manager routines.
  115.  
  116. Apple started to document the internal workings of MultiFinder,
  117. including MultiFinder equivalents of many of the System 7 Process
  118. Manager routines, in Tech Note 299, but then decided not to release
  119. it.  Fortunately, a few copies of TN299 did manage to sneak out, and I
  120. managed to get my hands on a copy of a copy of a copy, so here's the
  121. information you need:
  122.  
  123. According to TN 299, a MultiFinder 6.0.x process information record
  124. looks like:
  125.  
  126. typedef struct {
  127.     short           processState;               /* process state */
  128.     short           processID;                  /* process id */
  129.     OSType          processType;                /* type of process (usually 'APPL') */
  130.     OSType          processSignature;           /* signature of process */
  131.     long            processVersion;             /* version of process */
  132.     THz             processZone;                /* pointer to minor zone */
  133.     unsigned long   processMode;                /* process' created mode */
  134.     Boolean         processNeedSusResEvts;      /* expects suspend/resume events */
  135.     Boolean         processBack;                /* can accept background time */
  136.     Boolean         processActivateOnResume;    /* will activate/deactivate on suspend/resume */
  137.     short           processDad;                 /* process id of my dad */
  138.     unsigned long   processSize;                /* size of his world */
  139.     unsigned long   processStackSize;           /* size of his stack */
  140.     unsigned long   processSlices;              /* # of times process has CPU */
  141.     unsigned long   processFreeMem;             /* amount of free memory in heap */
  142.     Str32           processName;                /* name of backing app */
  143.     short           processVRefNum;             /* vRefNum of app res file */
  144.     
  145. } MFProcessInfoRec;
  146.  
  147. I won't list all the routines here, but the relevant ones for your
  148. purposes are:
  149.  
  150. #define MFA5        0x0B7C      /* lo-mem global containing MF A5 value */
  151. #define FrontPID    0xFFFFF7CE  /* offset of front process ID from MF A5 */
  152.  
  153. pascal short MFGetCurrentProcess()
  154.     = { 0x3F3C, 0x0013, 0xA88F };
  155. pascal short MFGetProcessInformation(short PID, MFProcessInfoRec *procInfo)
  156.     = { 0x3F3C, 0x0017, 0xA88F };
  157.  
  158. pascal short MFGetFrontProcess()
  159. {
  160.     return (*((short *)(*MFA5+FrontPID)));
  161. }
  162.  
  163. Once you've ascertained that you're running under System 6.0.x with
  164. MultiFinder, you should be able to determine if the current process is
  165. the front process simply by checking if MFGetCurrentProcess() ==
  166. MFGetFrontProcess().
  167.  
  168. Chris.
  169. - -- 
  170. - ------------------------------------------------------------------------------
  171. Chris Wysocki                                     Internet: wysocki@netcom.com
  172. Software Engineer                                   America Online: AFA ChrisW
  173. Connectix Corporation                                   CompuServe: 72010,1140
  174.  
  175. +++++++++++++++++++++++++++
  176.  
  177. From: russotto@eng.umd.edu (Matthew T. Russotto)
  178. Date: 9 Dec 92 02:20:09 GMT
  179. Organization: Project GLUE, University of Maryland, College Park
  180.  
  181. In article <1992Dec8.175940.25481@netcom.com> wysocki@netcom.com (Chris Wysocki) writes:
  182. >
  183. >I won't list all the routines here, but the relevant ones for your
  184. >purposes are:
  185. >
  186. >#define MFA5        0x0B7C      /* lo-mem global containing MF A5 value */
  187. >#define FrontPID    0xFFFFF7CE  /* offset of front process ID from MF A5 */
  188. >
  189. >pascal short MFGetCurrentProcess()
  190. >    = { 0x3F3C, 0x0013, 0xA88F };
  191. >pascal short MFGetProcessInformation(short PID, MFProcessInfoRec *procInfo)
  192. >    = { 0x3F3C, 0x0017, 0xA88F };
  193. >
  194. >pascal short MFGetFrontProcess()
  195. >{
  196. >    return (*((short *)(*MFA5+FrontPID)));
  197. >}
  198. >
  199. >Once you've ascertained that you're running under System 6.0.x with
  200. >MultiFinder, you should be able to determine if the current process is
  201. >the front process simply by checking if MFGetCurrentProcess() ==
  202. >MFGetFrontProcess().
  203.  
  204. Don't believe everything you read in an unreleased tech note.
  205. Specifically, MFGetFrontProcess simply won't compile as written.
  206.  
  207. replace the 'return' line with
  208.     return (*((short *)((*(long *)MFA5)+FrontPID)));
  209.  
  210. - -- 
  211. Matthew T. Russotto    russotto@eng.umd.edu    russotto@wam.umd.edu
  212. Some news readers expect "Disclaimer:" here.
  213. Just say NO to police searches and seizures.  Make them use force.
  214. (not responsible for bodily harm resulting from following above advice)
  215.  
  216. ---------------------------
  217.  
  218. From: mssmith@afterlife.ncsc.mil (M. Scott Smith)
  219. Subject: In search of SYNCHING code
  220. Organization: The Great Beyond
  221. Date: Mon, 7 Dec 1992 22:58:00 GMT
  222.  
  223. Maybe my subjects aren't good enough?  I don't know.  It just seems <sulk>
  224. everyone ignored me when I posted problems I was having getting in sync with
  225. the monitor, for smooth graphics, etc.
  226.  
  227. So, like any netter, I'm doing the logical thing.  I'm asking again!  :)
  228.  
  229. Ok, I want to sync to the monitor.  There's nice sample code in the Internet
  230. Mac Programmer's Guide on sumex (or whatever it's called,) except that it
  231. doesn't seem to work.
  232.  
  233. I could hack around with it a bit (well, I already have), but I haven't even
  234. heard the code works (with System 7?  Period?) so I don't want to run around
  235. in circles.
  236.  
  237. So, please, if you have any sample code for synching to the monitor, or
  238. if you know that the code I'm referring to either works or doesn't work, pass
  239. that info along.
  240.  
  241. And if you don't, well, I'll just have to start posting exotic subjects
  242. which will result in more people reading my message and more people not
  243. responding.  :)
  244.  
  245. Thanks in advance for any help..
  246.  
  247. M. Scott Smith
  248.   (mssmith@afterlife.ncsc.mil)
  249.  
  250.  
  251. +++++++++++++++++++++++++++
  252.  
  253. From: werner@soe.berkeley.edu (John Werner)
  254. Date: 8 Dec 92 01:51:50 GMT
  255. Organization: UC Berkeley School of Education
  256.  
  257. In article <1992Dec7.225800.6438@afterlife.ncsc.mil>, M. Scott Smith wrote:
  258.  
  259. > So, please, if you have any sample code for synching to the monitor, or
  260. > if you know that the code I'm referring to either works or doesn't work, pass
  261. > that info along.
  262.  
  263. I have some code I whipped up last week, but it's part of a MacApp/C++
  264. program, so it probably wouldn't do you much good.  But it wasn't that hard
  265. to do; it only took me an hour or so do do a nice general solution.  Here's
  266. what you need to do:
  267.  
  268. 1) Set up a task record for your VBL task.  The task needs to run at every
  269. VBL interrupt (vblCount = 1).  The vblAddr field needs to point to a
  270. function that you write...
  271.  
  272. 2) The function's job is to increment a counter somewhere, then set
  273. vblCount back to 1.  The counter can be a global variabIe, which means you
  274. have to worry about setting/restoring A5, since it isn't valid at interrupt
  275. time.  I decided to be clever and put my counter inside the task record
  276. itself; this way I didn't have to mess with A5 at all.  I just stash away a
  277. pointer to the task record so I can get to the counter later when I need to
  278. draw.  (C++ note: my task record is actually a pointer-based C++ object,
  279. complete with constructor and other methods.)
  280.  
  281. 3) Install the task.  If SlotVInstall is available, you need to figure out
  282. which monitor you're dealing with.  Find the GDevice that contains the
  283. largest piece of your window/view/whatever.  You can walk the device list
  284. yourself, or use DeviceLoop to do it for you.  Then use SlotVInstall to
  285. install it.  If SlotVInstall isn't available, you don't have to worry about
  286. devices; just use VInstall.
  287.  
  288. 4) When it's time to draw something, get the value of the counter, then sit
  289. in a tight loop until the counter changes, e.g. 
  290.     // Wait for the counter to change
  291.     long oldCount = theRec->counter;
  292.     while (theRec->counter == oldCount)
  293.         ;
  294. Then do your drawing.
  295.  
  296. 5) Remember to remove the task with SlotVRemove or VRemove when you're
  297. done.
  298.  
  299.  
  300. - --
  301. John Werner                         werner@soe.berkeley.edu
  302. UC Berkeley School of Education     510-642-9651
  303.  
  304. +++++++++++++++++++++++++++
  305.  
  306. From: mkelly@mystix.cs.uoregon.edu (Michael A. Kelly)
  307. Organization: High Risk Ventures
  308. Date: Tue, 8 Dec 1992 03:58:09 GMT
  309.  
  310.  
  311. In article <1992Dec7.225800.6438@afterlife.ncsc.mil> you write:
  312. >Maybe my subjects aren't good enough?  I don't know.  It just seems <sulk>
  313. >everyone ignored me when I posted problems I was having getting in sync with
  314. >the monitor, for smooth graphics, etc.
  315.  
  316. Oh, waahh!
  317.  
  318. Here you go:
  319.  
  320. /*
  321.  * VBLSync.h
  322.  *
  323.  */
  324.  
  325.  
  326. #ifndef _H_VBLSync
  327. #define _H_VBLSync
  328.  
  329.  
  330.  
  331. // Error codes
  332.  
  333. /* None */
  334.  
  335.  
  336.  
  337. // Global variables
  338.  
  339. #ifdef VBLSyncSource
  340.  
  341. long            gVblCounter;        // The VBL counter
  342.  
  343. #else VBLSyncSource
  344.  
  345. extern long     gVblCounter;        // The VBL counter
  346.  
  347. #endif VBLSyncSource
  348.  
  349.  
  350.  
  351. // Function prototypes
  352.  
  353. void InstallSync( GDHandle theDevice );
  354. void RemoveSync( void );
  355. void WaitForSync( void );
  356.  
  357.  
  358.  
  359.  
  360. #endif _H_VBLSync
  361.  
  362.  
  363.  
  364.  
  365.  
  366.  
  367. /*
  368.  * VBLSync.c
  369.  *
  370.  *    Implements a VBL counter on any Mac.
  371.  *
  372.  *    Usage:
  373.  *        InstallSync();
  374.  *        ...
  375.  *        WaitForSync();
  376.  *        CopyBits(...);
  377.  *        ...
  378.  *        RemoveSync();
  379.  *
  380.  */
  381.  
  382.  
  383. #define VBLSyncSource
  384.  
  385. #include "VBLSync.h"
  386.  
  387.  
  388.  
  389. typedef struct {
  390.  
  391.     long        goodA5;
  392.     VBLTask     task;
  393.     long        slot;
  394.  
  395. }    VideoBlank;
  396.  
  397.  
  398.  
  399. static VideoBlank    blank;
  400.  
  401.  
  402.  
  403.  
  404. static pascal void DoTask( void );
  405.  
  406.  
  407.  
  408.  
  409.  
  410. /*
  411.  * DoTask
  412.  *
  413.  */
  414.  
  415. static pascal void DoTask()
  416. {
  417.  
  418.     long        oldA5;
  419.     VideoBlank  vbltask;
  420.  
  421.     asm {
  422.     
  423.         MOVE.L    A5, oldA5     ; save off the old value of A5
  424.         MOVE.L    -4(A0), A5    ; A0 points to our VBL task record, and
  425.                                 ; earlier we saved CurrentA5 near it
  426.         
  427.     }
  428.     
  429.     ++ gVblCounter;
  430.     
  431.     blank.task.vblCount = 1;    // run again as soon as possible
  432.  
  433.     asm {
  434.         MOVE.L    oldA5, A5
  435.     }
  436.  
  437. }
  438.  
  439.  
  440.  
  441.  
  442. /*
  443.  * InstallSync
  444.  *
  445.  */
  446.  
  447. void InstallSync(
  448.     GDHandle    theDevice )
  449. {
  450.  
  451.     AuxDCEHandle    driver;
  452.  
  453.     blank.goodA5 = (long) CurrentA5;
  454.     gVblCounter = 0;
  455.  
  456.     blank.task.qType = vType;
  457.     blank.task.vblAddr = (ProcPtr) DoTask;
  458.     blank.task.vblCount = 1;
  459.     blank.task.vblPhase = 0;
  460.  
  461.     driver = (AuxDCEHandle) GetDCtlEntry( (*theDevice)->gdRefNum );
  462.     blank.slot = (*driver)->dCtlSlot;
  463.  
  464.     SlotlVInstall( (QElemPtr) &blank.task, blank.slot );
  465.  
  466. }
  467.  
  468.  
  469.  
  470.  
  471. /*
  472.  * RemoveSync
  473.  *
  474.  */
  475.  
  476. void RemoveSync()
  477. {
  478.  
  479.     SlotVRemove( (QElemPtr) &blank.task, blank.slot );
  480.  
  481. }
  482.  
  483.  
  484.  
  485.  
  486. /*
  487.  * WaitForSync
  488.  *
  489.  */
  490.  
  491. void WaitForSync()
  492. {
  493.  
  494.     long    counter = gVblCounter;
  495.  
  496.     while ( counter == gVblCounter );
  497.  
  498. }
  499.  
  500.  
  501.  
  502.  
  503. - -- 
  504. _____________________________________________________________________________
  505. Michael A. Kelly                                               Senior Partner
  506. mkelly@cs.uoregon.edu                                      High Risk Ventures
  507. _____________________________________________________________________________
  508.  
  509. +++++++++++++++++++++++++++
  510.  
  511. From: Chris Verret <cverret@vnet3.vub.ac.be>
  512. Date: 9 Dec 92 14:36:45 GMT
  513. Organization: Vrije Universiteit Brussel
  514.  
  515. In october the thread "Best way to get A5 into VBLTaskProc?" was
  516. posted on comp.sys.mac.programmer. Several answers were given:
  517. self-modifying code, sticking A5 right next to the VBLTask and using
  518. SetA5,...
  519. I was just experimenting with the first one myself, when Tim Dierks
  520. followed up the thread and hinted me towards another, more elegant
  521. solution. Hope he don't mind me quoting him:
  522.  
  523. >In fact, if you didn't want to screw around with A5 and all that other
  524. >garbage, you could just set up your structure like this:
  525. >
  526. >typedef struct {
  527. >    VBLTask     gTask;
  528. >    long        gVBLCount;
  529. >} MyVBLTask;
  530. >
  531. >and mess with the variable directly; this way, you don't use globals,
  532. >so you don't have to sweat the whole A5 thing.
  533.  
  534. This is how I did it:
  535.  
  536. typedef struct {
  537.     VBLTask            task;
  538.     short                videoslot;
  539.     long                count;
  540. } VBLCounterRec;
  541.  
  542. VBLCounterRec VBLCounter;
  543.  
  544. /************************************************************/
  545.  
  546. Boolean InstallVBLCounter(void)
  547. {
  548.     DefVideoRec            VBLVideoDefault;
  549.  
  550.     VBLCounter.task.vblAddr = VBLCounterProc;
  551.     VBLCounter.task.qType = vType;
  552.     VBLCounter.task.vblCount = 1;
  553.     VBLCounter.task.vblPhase = 0;
  554.     
  555.     GetVideoDefault(&VBLVideoDefault);
  556.     VBLCounter.videoslot = VBLVideoDefault.sdSlot;
  557.  
  558.     VBLCounter.count = 0;
  559.     
  560.     return (SlotVInstall((QElemPtr)&VBLCounter.task, VBLCounter.videoslot)
  561. == noErr);
  562. }
  563.  
  564. /************************************************************/
  565.  
  566. Boolean RemoveVBLCounter(void)
  567. {
  568.     return (SlotVRemove((QElemPtr)&VBLCounter.task, VBLCounter.videoslot) ==
  569. noErr);
  570. }
  571.  
  572. /************************************************************/
  573.  
  574. pascal void VBLCounterProc(void)
  575. {
  576.     asm {    
  577.         MOVE.W    #1, OFFSET(VBLCounterRec, task.vblCount) (A0)
  578.         ADDQ.L    #1, OFFSET(VBLCounterRec, count) (A0)
  579.     }
  580. }
  581.  
  582. TN 180 : "...on entry into the VBL task, A0 points to the
  583. theVBLTask field in the VBLRec record, which is the first field in the
  584. record..."
  585.  
  586. Good Luck!
  587.  
  588. ---------------------------
  589.  
  590. From: kevinc@scvme3.uucp (Kevin Cutts)
  591. Subject: pbhopendf returns -50?
  592. Date: 8 Dec 92 14:28:56 GMT
  593. Organization: Motorola Microcomputer, Schaumburg, IL
  594.  
  595. with error code = -50. According to IM (both V4 and files) this routine 
  596. can't return -50! I am zeroizing the pb block before the call and setting
  597. the required values from an sfreply structure. This bug only happens for 
  598. one of my users. He is using sys6.0.8 running on a IIci. I looked at his
  599. init's but didn't see anything strange. My code is developed using Think C
  600. version 5.0.4. I looked at some of the related calls in the toolbox 
  601. that can return a -50 but can't get a clue.
  602. Any help?
  603.  
  604. +++++++++++++++++++++++++++
  605.  
  606. From: absurd@apple.apple.com (Tim Dierks, software saboteur)
  607. Date: 8 Dec 92 20:56:18 GMT
  608. Organization: MacDTS Marauders
  609.  
  610. In article <1301@scvme3.UUCP>, kevinc@scvme3.uucp (Kevin Cutts) wrote:
  611. > with error code = -50. According to IM (both V4 and files) this routine 
  612. > can't return -50! I am zeroizing the pb block before the call and setting
  613. > the required values from an sfreply structure. This bug only happens for 
  614. > one of my users. He is using sys6.0.8 running on a IIci. I looked at his
  615. > init's but didn't see anything strange. My code is developed using Think C
  616. > version 5.0.4. I looked at some of the related calls in the toolbox 
  617. > that can return a -50 but can't get a clue.
  618. > Any help?
  619.  
  620. The error list given with a function should not be regarded as complete;
  621. a number of traps can return other codes for various reasons; the list
  622. is only intended to give you a list of unique things that might happen
  623. which you might wish to specifically check for.  In this case, you've
  624. found out that traps which are dispatched (where several calls share a
  625. trap and are distinguished by a value, usually passed in D0 or on the
  626. stack) return paramErr when you pass a selector they don't understand.
  627.  
  628. In this case, you're calling HOpenDF, which is a routine which uses
  629. the trap _HFSDispatch with selector $1A, under System 6.0.8 when
  630. it is only supported under System 7.  Because the 6.0.8 HFSDispatch
  631. doesn't understand selector $1A, it returns paramErr.
  632.  
  633. Solution: only use PBHOpenDF under System 7 or later.  There's no
  634. specific Gestalt selector for determining if it is available; mosst
  635. people just check to see if the gestaltHasFSSpecCalls bit is set
  636. in the response to the gestaltFSAttr selector.  (Or you could just
  637. try calling it, and if it returns -50, calling PBHOpen instead.)
  638.  
  639. Hope this helps (TM)
  640. Tim Dierks
  641.  
  642. +++++++++++++++++++++++++++
  643.  
  644. From: leonardr@netcom.com (Leonard Rosenthol)
  645. Date: 9 Dec 92 00:07:09 GMT
  646. Organization: Netcom - Online Communication Services  (408 241-9760 guest)
  647.  
  648. In article <1301@scvme3.UUCP> kevinc@scvme3.uucp (Kevin Cutts) writes:
  649. >with error code = -50. According to IM (both V4 and files) this routine 
  650. >can't return -50! 
  651. >
  652.     It can under one condition...
  653.  
  654. >I am zeroizing the pb block before the call and setting
  655. >the required values from an sfreply structure. 
  656. >
  657.     That's the condition...
  658.  
  659.     If you pass a WDRefNum (which is what you really get in the vRefNum
  660. field of an SFReply) in the vRefNum field and you clear out all the other
  661. fields, you can get back a -50 since this isn't a correctly formed paramBlock.
  662.  
  663.     You should use PBGetWDInfo to convert the WDRefNum into a real vRefNum
  664. and parID and then pas them to the PBHOpenDF.
  665.  
  666. - -- 
  667. - -----------------------------------------------------------------------------
  668. Leonard Rosenthol            Internet:     leonardr@netcom.com
  669. Director of Advanced Technology        AppleLink:    MACgician
  670. Aladdin Systems, Inc.            GEnie:        MACgician
  671.  
  672. ---------------------------
  673.  
  674. From: urban@stout.atd.ucar.edu (Art Urban (PROFS))
  675. Subject: TCL: What Are They Trying to Say?
  676. Date: 8 Dec 92 19:26:31 GMT
  677. Organization: Atmospheric Technology Division/NCAR Boulder, CO
  678.  
  679. On page 281 of the TCL OOP Manual, CDirectorOwner makes a desperate attempt
  680. at explaining how to implement multi-window documents. In this futile attempt,
  681. they state "The subwindows should be owned by the document object."
  682.  
  683. Say what? CDocument only owns *one* window in the itsWindow variable. Are
  684. they trying (poorly) to say that my subclasses of CDirector should become
  685. dependents of CDocument, or what?
  686.  
  687. Cripes! The OOP Manual needs its own manual just to explain itself...
  688.  
  689. - --
  690. Art Urban                            urban@stout.atd.ucar.edu
  691. ===============================================================================
  692.  "Baby trapped in film, eats own hand."                    - Joel
  693. ===============================================================================
  694.  
  695. +++++++++++++++++++++++++++
  696.  
  697. From: d88-jwa@dront.nada.kth.se (Jon Wtte)
  698. Date: 9 Dec 92 10:19:50 GMT
  699. Organization: Royal Institute of Technology, Stockholm, Sweden
  700.  
  701. In <1992Dec8.192631.27712@ncar.ucar.edu> urban@stout.atd.ucar.edu (Art Urban (PROFS)) writes:
  702.  
  703. >On page 281 of the TCL OOP Manual, CDirectorOwner makes a desperate attempt
  704. >at explaining how to implement multi-window documents. In this futile attempt,
  705. >they state "The subwindows should be owned by the document object."
  706.  
  707. >Say what? CDocument only owns *one* window in the itsWindow variable. Are
  708. >they trying (poorly) to say that my subclasses of CDirector should become
  709. >dependents of CDocument, or what?
  710.  
  711. There are better refs in the Dialog Classes teach text document.
  712.  
  713. Anyway, do this:
  714.  
  715. Make your main document a CDirectorOwner, and have one CDirector
  716. for EACH window you use. Make the "main" document CDirectorOwner
  717. be the owner/supervisor of all the CDirectors that go with the
  718. document (and the Application the supervisor of the CDirectorOwner)
  719.  
  720. Note that a CDirector is a subclass of a CDirectorOwner, so you
  721. can cooly use a CDirector (or, indeed, CDocument) as "main"
  722. CDirectorOwner.
  723.  
  724. Cheers,
  725.  
  726.                         / h+
  727.  
  728. - -- 
  729.  -- Jon W{tte, h+@nada.kth.se, Mac Hacker Deluxe --
  730.    This signature is kept shorter than 4 lines in the interests of UseNet
  731.    S/N ratio.
  732.  
  733. +++++++++++++++++++++++++++
  734.  
  735. From: pw1r+@andrew.cmu.edu (Peter William Wieland)
  736. Date: 8 Dec 92 22:27:14 GMT
  737. Organization: Sophomore, Electrical and Computer Engineering, Carnegie Mellon, Pittsburgh, PA
  738.  
  739. On 08-Dec-92 in TCL: What Are They Trying t..
  740. user Art Urban @stout.atd.uca writes:
  741. >Say what? CDocument only owns *one* window in the itsWindow variable. Are
  742. >they trying (poorly) to say that my subclasses of CDirector should become
  743. >dependents of CDocument, or what?
  744. >Cripes! The OOP Manual needs its own manual just to explain itself...
  745.  
  746. Since you have to override CDocument anyway (as i remember, it is one of
  747. the necessary classes to "customize"), you should probably add some more
  748. window variables (itsPalette, itsLoadDisplay, itsWastedPtr, etc...) to
  749. the subclass.  There should be some way to inform windows that they are
  750. under your control (i don't really rember what it was, but...).
  751.  
  752.  
  753. ****************************************************************************
  754. None of the ideas expressed above are acutally mine.  They are told to
  755. me by Luthor and Ferdinand, the five inch tall space aliens who live
  756. under my desk.  In return for these ideas, I have given them persmision
  757. to eat any dust bunnies they may find under there.
  758. Peter Wieland               pw1r+@andrew.cmu.edu            dmonger+@cmu.edu
  759.  
  760. +++++++++++++++++++++++++++
  761.  
  762. From: joshr@kronos.arc.nasa.gov (Joshua Rabinowitz-Summer-91)
  763. Organization: NASA/ARC Information Sciences Division
  764. Date: Wed, 9 Dec 1992 23:51:13 GMT
  765.  
  766. In article <Uf9OrWa00iV4I=8Htn@andrew.cmu.edu> pw1r+@andrew.cmu.edu (Peter William Wieland) writes:
  767. >On 08-Dec-92 in TCL: What Are They Trying t..
  768. >user Art Urban @stout.atd.uca writes:
  769. >>Say what? CDocument only owns *one* window in the itsWindow variable. Are
  770. >>they trying (poorly) to say that my subclasses of CDirector should become
  771. >>dependents of CDocument, or what?
  772.  
  773. That your subclasses of CDIrector should have your subclass of CDoc
  774. as their supervisor.
  775.  
  776. >> 
  777. >>Cripes! The OOP Manual needs its own manual just to explain itself...
  778. >
  779. >Since you have to override CDocument anyway (as i remember, it is one of
  780. >the necessary classes to "customize"), you should probably add some more
  781. >window variables (itsPalette, itsLoadDisplay, itsWastedPtr, etc...) to
  782.  
  783.  
  784. NO!  ADD DIRECTORS!
  785.  
  786. >the subclass.  There should be some way to inform windows that they are
  787. >under your control (i don't really rember what it was, but...).
  788. >
  789. >
  790.  
  791. OOOH!  I couldn't help but enter this fray, as I have BEEN THERE.
  792.  
  793. Peter -- that is wrong (I mean, problematic).  The problem 
  794. there is the owners of window, etc.
  795. Each window must have ITS OWN DIRECTOR.  Subclass CDirector to handle each 
  796. window (that is, make aninstantiation of a CDirector (or subclass)
  797. to handle each window.
  798.  
  799. The supervisor structure I use is:
  800.  
  801. CApp -> CDoc -> CDirector, where CDoc keeps track of the main window, and
  802. CDirector keeps track of the 2nd window.
  803.  
  804. A format recomended to me as better, was
  805.  
  806. CApp -> CDoc -> CDirector -> mainwindow
  807.          -> CDirector -> 2ndWindow.
  808.  
  809. that way, you can set CDoc->itsMainpPane to point at the active window pane,
  810. which is the one that will be printed.  Also, a single call to CDoc->Close()
  811. will close both CDirectors and each's window.
  812.  
  813.  
  814. Excuse me if I was a little unclear:
  815. summary:
  816. each window must have it's own director (not each director need have
  817. a window though).
  818. - -- 
  819. - ----------------------------------
  820. #include <std/disclaimer.h>     Josh Rabinowitz, Mac TCL programmer
  821. joshr@kronos.arc.nasa.gov
  822. "Me lost my cookie at the disco." -- Cookie Monster
  823.  
  824. ---------------------------
  825.  
  826. From: kkirksey@world.std.com (Ken B Kirksey)
  827. Subject: 'appe' File Type
  828. Date: 8 Dec 92 23:21:32 GMT
  829. Organization: The World Public Access UNIX, Brookline, MA
  830.  
  831. Can anyone point me to information on the 'appe' file type?  I'm looking at
  832. writing a background only app, and would like a little more info that is 
  833. provided in IM VI and IM:Processes (i.e. almost none:).  How is it handled
  834. in the startup process?  When do 'appe' files in the Extensions folder 
  835. load?  Many thanks in advance.
  836.  
  837.  
  838.                             Ken
  839.  
  840. +----------------------------+------------------------------------------------+
  841. | Ken Kirksey                | "A man cannot be too careful in his choice     |
  842. | kkirksey@world.std.com     |  of enemies."                                  |
  843. | The World, Brookline, MA   |                - Oscar Wilde                   |
  844.  
  845. - -- 
  846. +----------------------------+------------------------------------------------+
  847. | Ken Kirksey                | "A man cannot be too careful in his choice     |
  848. | kkirksey@world.std.com     |  of enemies."                                  |
  849. | The World, Brookline, MA   |                - Oscar Wilde                   |
  850.  
  851. +++++++++++++++++++++++++++
  852.  
  853. From: lkimes@alshain.usc.edu (Lance 'Moof' Kimes)
  854. Date: 8 Dec 92 08:29:21 GMT
  855. Organization: University of Southern California, Los Angeles, CA
  856.  
  857.  
  858. In article <ByyrJw.J5A@world.std.com>, kkirksey@world.std.com (Ken B Kirksey) writes:
  859. |> Can anyone point me to information on the 'appe' file type?  I'm looking at
  860. |> writing a background only app, and would like a little more info that is 
  861. |> provided in IM VI and IM:Processes (i.e. almost none:).  How is it handled
  862. |> in the startup process?  When do 'appe' files in the Extensions folder 
  863. |> load?  Many thanks in advance.
  864. |>  
  865. |>  
  866. |>                             Ken
  867. |> 
  868. |> +----------------------------+------------------------------------------------+
  869. |> | Ken Kirksey                | "A man cannot be too careful in his choice     |
  870. |> | kkirksey@world.std.com     |  of enemies."                                  |
  871. |> | The World, Brookline, MA   |                - Oscar Wilde                   |
  872. |> 
  873. |> -- 
  874. |> +----------------------------+------------------------------------------------+
  875. |> | Ken Kirksey                | "A man cannot be too careful in his choice     |
  876. |> | kkirksey@world.std.com     |  of enemies."                                  |
  877. |> | The World, Brookline, MA   |                - Oscar Wilde                   |
  878.  
  879. They're identical to normal appls except that you don't initial any managers 
  880. that use the gui(ie:window,dialog,etc). Make it accept required apple events. 
  881. All appe load alphabetically before all other programs including the finder.
  882. Be sure to include a -1 SIZE resource that specifies background only and apple
  883. event aware.
  884.  
  885.  
  886. Lance Kimes
  887. Systems Programmer
  888. USC
  889.  
  890. +++++++++++++++++++++++++++
  891.  
  892. From: schulte@klin.far.ruu.nl (Bas Schulte, Spider)
  893. Date: 9 Dec 92 09:02:38 GMT
  894. Organization: UTexas Mail-to-News Gateway
  895.  
  896. Dear Ken,
  897.  
  898. you asked:
  899.  
  900. > Can anyone point me to information on the 'appe' file
  901. > type?  I'm looking at writing a background only app
  902.  
  903. All I can tell you is how the initialize 'THE MANAGERS' in a bg app. This is how 
  904. I do it, as compared to a standard init.:
  905.  
  906.  
  907. {$IFC CompilingBgApp}
  908. procedure InitMgrs;
  909. begin
  910.     InitGraf(@thePort);
  911.     InitFonts
  912. end;
  913. {$ELSEC}
  914. procedure InitMgrs;
  915. begin
  916.     InitGraf(@thePort);
  917.     InitFonts;
  918.     InitWindows;
  919.     InitMenus;
  920.     TEInit;
  921.     InitDialogs(NIL);
  922.     InitCursor;
  923. end;
  924. {$ENDC}
  925.  
  926. ---------------------------
  927.  
  928. From: davidp@calvin.usc.edu (David Peterson)
  929. Subject: Just for you, an early Christmas present
  930. Date: 2 Dec 1992 12:17:32 -0800
  931. Organization: University of Southern California, Los Angeles, CA
  932.  
  933.  
  934.  
  935. Now you, the Mac programmer, can have pages of useless strings effortlessly
  936. vomited to your screen just like your DOS and UNIX friends do.
  937.  
  938. With this dandy new MBPrintf routine you can make up printf style diagnostic
  939. messages and have them show up in MacsBug correctly interpreted and formatted.
  940.  
  941. Okay, so this is just a little hack I threw together with a liberal amount
  942. copyright infringment (see pg 156 of K&R). After a few hours of using it
  943. I found it extremely useful, and it has earned a permanent place in my 
  944. personal library (not unlike every other snippet of code I come across).
  945.  
  946. Hopefully you will find it just as useful, but (as always) your mileage
  947. may vary.
  948.  
  949. Handy tip:
  950.     Instead of putting a '\n' at the end of your string try a semi-colon
  951.     followed by Your Favorite MacsBug Command. ';g' is probably the most
  952.     useful and ';s 3' will take you back to the instruction right after
  953.     the JSR into this function. Combinations of ';dx off'/';dx on' could
  954.     be good too.
  955.  
  956. Caveats:
  957.     This will probably blow up if called from interupt. It makes calls
  958.     into the StdCLib segment which may or may not be loaded.
  959.  
  960.     Probably won't work in stand alone code resources because the
  961.     aforementioned code segment contains global data.
  962.  
  963.     I don't know what will happen if your string gets over 255 characters,
  964.     but it probably won't be what you expected.
  965.  
  966.  
  967. - -dave.
  968.  
  969. - ---------------------------
  970.  
  971. #include <StdArg.h>
  972. #include <StdIO.h>
  973.  
  974. void MBPrintf(char* form, ...);
  975.  
  976. void
  977. MBPrintf(char* form, ...)
  978. {
  979.     va_list    ap;
  980.     char*    p;
  981.  
  982.     char*    sval;
  983.     int        ival;
  984.     double    dval;
  985.  
  986.     char    string[256];
  987.     char*    strp;
  988.     char*    strb;
  989.     
  990.     strp = &string[1];
  991.     strb = &string[1];
  992.     
  993.     va_start(ap, form);
  994.     
  995.     for (p = form; *p; p++) {
  996.         if (*p != '%') {
  997.             *strp++ = *p;
  998.             continue;
  999.         }
  1000.         
  1001.         switch (*++p) {
  1002.             case 'd':
  1003.                 ival = va_arg(ap, int);
  1004.                 sprintf(strp, "%d", ival);
  1005.                 while (*++strp);
  1006.                 break;
  1007.             case 'x':
  1008.                 ival = va_arg(ap, int);
  1009.                 sprintf(strp, "%x", ival);
  1010.                 while (*++strp);
  1011.                 break;
  1012.             case 'f':
  1013.                 dval = va_arg(ap, double);
  1014.                 sprintf(strp, "%f", dval);
  1015.                 while (*++strp);
  1016.                 break;
  1017.             case 's':
  1018.                 for (sval = va_arg(ap, char*); *sval; sval++)
  1019.                     *strp++ = *sval;
  1020.                 break;
  1021.             default:
  1022.                 *strp++ = *p;
  1023.                 break;
  1024.         }
  1025.     }
  1026.     
  1027.     va_end(ap);
  1028.     
  1029.     string[0] = strp - strb;
  1030.     DebugStr((Str255) string);
  1031. }
  1032.  
  1033.  
  1034.  
  1035.  
  1036.  
  1037. +++++++++++++++++++++++++++
  1038.  
  1039. From: bowman@reed.edu (BoBoRamDos)
  1040. Date: 2 Dec 92 20:56:21 GMT
  1041. Organization: Reed College, Portland, OR
  1042.  
  1043. Perhaps I'm missing something, but seems to be roughly equivalent, but much
  1044. less elegant than a snippet someone posted some months ago and which is also
  1045. quite useful.  Unfortunately I can't remember where this came from, but it
  1046. sure is nice:
  1047.  
  1048. void vdebugstr(char* format,...) {
  1049.         char buff[257];
  1050.         va_list arglist;
  1051.         vs_start(arglist,format);
  1052.         vsprintf(buff,format,arglist);
  1053.         va_end(arglist);
  1054.         DebugStr(c2pstr(buff));
  1055. }
  1056.  
  1057. cheers,
  1058. bobo              In seeking the unattainable,
  1059. bowman@reed.edu            simplicity only gets in the way.
  1060. Ask not what's inside your head but what your head's inside of. - W. Mace
  1061.  
  1062. +++++++++++++++++++++++++++
  1063.  
  1064. From: beard@toadflax.cs.ucdavis.edu (Patrick C. Beard)
  1065. Date: 4 Dec 92 01:14:20 GMT
  1066. Organization: Department of Computer Science, University of California, Davis
  1067.  
  1068.  
  1069. Here's a much shorter version I have been using for eons:
  1070.  
  1071. /*
  1072.     dprintf.c
  1073.  
  1074.     by Patrick C. Beard.
  1075. */
  1076.  
  1077. #include <stdarg.h>
  1078. #include <stdio.h>
  1079.  
  1080. int dprintf(const char* format, ...)
  1081. {
  1082.     va_list args;
  1083.     static char str[256];
  1084.     int count;
  1085.     
  1086.     va_start(args, format);
  1087.     count = vsprintf(str, format, args);
  1088.     va_end(args);
  1089.     DebugStr(c2pstr(str));
  1090.     return count;
  1091. }
  1092.  
  1093. Let the library do the work, I say.
  1094.  
  1095. // Patrick C. Beard
  1096. // Department of Computer Science, U. C. Davis
  1097. // pcbeard@ucdavis.edu
  1098.  
  1099. +++++++++++++++++++++++++++
  1100.  
  1101. From: ksand@apple.com (Kent Sandvik )
  1102. Date: 4 Dec 92 22:50:13 GMT
  1103. Organization: Apple
  1104.  
  1105. In article <19836@ucdavis.ucdavis.edu>, beard@toadflax.cs.ucdavis.edu
  1106. (Patrick C. Beard) wrote:
  1107. > Here's a much shorter version I have been using for eons:
  1108. > /*
  1109. >     dprintf.c
  1110. >     by Patrick C. Beard.
  1111. > */
  1112. > #include <stdarg.h>
  1113. > #include <stdio.h>
  1114. > int dprintf(const char* format, ...)
  1115. > {
  1116. >     va_list args;
  1117. >     static char str[256];
  1118. >     int count;
  1119. >     
  1120. >     va_start(args, format);
  1121. >     count = vsprintf(str, format, args);
  1122. >     va_end(args);
  1123. >     DebugStr(c2pstr(str));
  1124. >     return count;
  1125. > }
  1126.  
  1127. Yeah, agree, the only issue is that you drop down somewhere far
  1128. beyond the actual point where the assert or something similar
  1129. triggered the print to DebugStr (due to the library calls). This
  1130. is why I have a lightweight assert that calls DebugStr directly,
  1131. and a heavy weight va_args assert for more information printing.
  1132.  
  1133. Kent
  1134. - -------------------
  1135. Kent Sandvik (UUCP: ....!apple!ksand; INTERNET: ksand@apple.com)
  1136. DISCLAIMER: Private activities on the Net.
  1137.  
  1138. +++++++++++++++++++++++++++
  1139.  
  1140. From: dowdy@apple.com (Tom Dowdy)
  1141. Date: 9 Dec 92 21:29:41 GMT
  1142. Organization: Apple Computer, Inc.
  1143.  
  1144. In article <1fj5ksINNo34@calvin.usc.edu>, davidp@calvin.usc.edu (David
  1145. Peterson) wrote:
  1146. > With this dandy new MBPrintf routine you can make up printf style diagnostic
  1147. > messages and have them show up in MacsBug correctly interpreted and formatted.
  1148.  
  1149. Maybe I'm missing something that yours does that mine doesn't - but this
  1150. routine is much simpler and does the same thing.  (Goeff Coco, if he's
  1151. out there anyplace, is the person to thank for originally writing this)
  1152.  
  1153. void debugprintf(char *sFormat, ...)
  1154. /*
  1155.     Take a printf style list of args, pass them on and debugstr them.
  1156.     Call as you would printf.
  1157. */
  1158. {
  1159.     Str255        sOut;
  1160.     va_list        pArgs;
  1161.  
  1162.     va_start(pArgs, sFormat);
  1163.     vsprintf(sOut, sFormat, pArgs);
  1164.     c2pstr(sOut);
  1165.     
  1166.     DebugStr(sOut);
  1167.     
  1168. } // debugprintf
  1169.  
  1170.  
  1171.  Tom Dowdy                 Internet:  dowdy@apple.COM
  1172.  Apple Computer MS:81KS    UUCP:      {sun,voder,amdahl,decwrl}!apple!dowdy
  1173.  20525 Mariani Ave         AppleLink: DOWDY1
  1174.  Cupertino, CA 95014       
  1175.  "The 'Ooh-Ah' Bird is so called because it lays square eggs."
  1176.  
  1177. ---------------------------
  1178.  
  1179. From: aep@world.std.com (Andrew E Page)
  1180. Subject: Adding Comm to an Application
  1181. Organization: The World Public Access UNIX, Brookline, MA
  1182. Date: Thu, 19 Nov 1992 14:21:27 GMT
  1183.  
  1184.  
  1185.    I've just picked up a client who wishes to add modem communications
  1186. to an application.  They're currently accomplishing the task with
  1187. terminal applications and terminal scripts.  They would like to cut
  1188. out the need for the terminal program and have the communications done
  1189. from within the application.  
  1190.    I know that eventually that they should go to a remote access
  1191. protocol, and I will be steering future work in that direction.
  1192. However, for the time being they just want to simplify their
  1193. current application.  
  1194.  
  1195.  
  1196.     My Major question is thus:
  1197.  
  1198.    1)   Just use the serial driver, and standard modem techniques.
  1199.  
  1200.  
  1201.    2)   Use the Sys 7  CommToolbox, connection manager, file transfer
  1202.         manager etc.  Probably a bit harder from what I've read
  1203.         thus far, but will make the migration to true networking
  1204.         easier down the road.
  1205.  
  1206.  
  1207.    3)   A Third alternative.
  1208.  
  1209. - -- 
  1210. Andrew E. Page   (Warrior Poet) |   Decision and Effort The Archer and Arrow
  1211. Mac Consultant                  |     The difference between what we are
  1212. Macintosh and DSP Technology    |           and what we want to be.
  1213.  
  1214. +++++++++++++++++++++++++++
  1215.  
  1216. From: sdorner@qualcomm.com (Steve Dorner)
  1217. Date: 24 Nov 92 16:21:59 GMT
  1218. Organization: Qualcomm, Inc.
  1219.  
  1220. In article <Bxyvvr.I64@world.std.com>, aep@world.std.com (Andrew E Page)
  1221. wrote:
  1222. >    2)   Use the Sys 7  CommToolbox, connection manager, file transfer
  1223. >         manager etc.  Probably a bit harder from what I've read
  1224. >         thus far, but will make the migration to true networking
  1225. >         easier down the road.
  1226.  
  1227. Using the CTB will be EASIER, not harder, than driving the serial ports
  1228. yourself, unless you intend to be very, very simple-minded about it.
  1229.  
  1230. It's also a lot more flexible in terms of what kinds of connections you can
  1231. make (though somewhat less flexible in terms of any given kind of
  1232. connection).
  1233.  
  1234. Use the CTB.  You will regret that less often than you will regret doing
  1235. your own.  :-)
  1236.  
  1237. - --
  1238. Steve Dorner, Qualcomm, Inc.
  1239.  
  1240. +++++++++++++++++++++++++++
  1241.  
  1242. From: fixer@faxcsl.dcrt.nih.gov (Chris Spiral Catfish Tate)
  1243. Date: 25 Nov 92 12:35:53 GMT
  1244. Organization: Computer Systems Laboratory, DCRT, NIH
  1245.  
  1246. In article <sdorner-241192101852@0.0.0.0>, sdorner@qualcomm.com (Steve Dorner) writes:
  1247. >
  1248. >Using the CTB will be EASIER, not harder, than driving the serial ports
  1249. >yourself, unless you intend to be very, very simple-minded about it.
  1250. >
  1251. >It's also a lot more flexible in terms of what kinds of connections you can
  1252. >make (though somewhat less flexible in terms of any given kind of
  1253. >connection).
  1254.  
  1255. Does the CTB support a reliable TCP/IP tool yet?  Last I heard it didn't, and
  1256. it's kept us from using it at all (since the Internet side of our app is
  1257. basically more important than the modem side).
  1258.  
  1259. Also, I seem to recall that there are licensing issues with providing MacTCP
  1260. along with your application; something about having to agree to take
  1261. responsibility for supporting fixes etc. to *MacTCP* as well as your own
  1262. product.  It's essentially preventing any government-funded product from
  1263. being distributed along with MacTCP.
  1264.  
  1265. - ------------------------------------------------------------------------------
  1266. Christopher Tate             | The Leadfoot Collection, Continued:
  1267. Management System Designers  |     * Hot Rod Lincoln (Commander Cody)
  1268.                              |     * The Man's Too Strong (Dire Straits) 
  1269. fixer@faxcsl.dcrt.nih.gov    |     * Sunshine of Your Love (Cream)
  1270.  
  1271. +++++++++++++++++++++++++++
  1272.  
  1273. From: time@ice.com (Tim Endres)
  1274. Date: Wed, 25 Nov 92 12:54:03 EST
  1275. Organization: ICE Engineering, Inc.
  1276.  
  1277.  
  1278. In article <1992Nov25.123553.10118@alw.nih.gov> (comp.sys.mac.programmer,comp.sys.mac.comm), fixer@faxcsl.dcrt.nih.gov (Chris Spiral Catfish Tate) writes:
  1279. > Does the CTB support a reliable TCP/IP tool yet?  Last I heard it didn't, and
  1280. > it's kept us from using it at all (since the Internet side of our app is
  1281. > basically more important than the modem side).
  1282.  
  1283. Get "TGE TCP Tool" from ftp.msen.com in /pub/vendor/ice.
  1284. This is a CTB MacTCP Tool. It is still a little limited,
  1285. but it does handle most of what people want.
  1286.  
  1287.  
  1288. tim endres - time@ice.com
  1289.  
  1290. Register your company in the Internet Business Pages!
  1291.  ...send email to "ibp-info@msen.com" for details...
  1292.  
  1293. USENET - a slow moving self parody... ph
  1294.  
  1295. +++++++++++++++++++++++++++
  1296.  
  1297. From: psaslaw@oc.com (Piet Saslawsky)
  1298. Date: 25 Nov 92 21:05:13 GMT
  1299. Organization: Advanced Software Concepts
  1300.  
  1301. In article <1992Nov25.123553.10118@alw.nih.gov> Chris Spiral Catfish
  1302. Tate, fixer@faxcsl.dcrt.nih.gov writes:
  1303. >Does the CTB support a reliable TCP/IP tool yet?  Last I heard it
  1304. didn't, and
  1305. >it's kept us from using it at all (since the Internet side of our app is
  1306. >basically more important than the modem side).
  1307.  
  1308. Not reliable ???  Well... just try our TCPack. It supports Telnet in both
  1309. directions : receive (of course !) and send (this may be useful for
  1310. XMODEM file transfers). It also includes a complete support for the
  1311. Scripting Interface, which can be used to configure all the IP parameters
  1312. : security, time-to-live, precedence or ip-options. Are also included a
  1313. FTP server and full support of Domain Name Resolver (hosts file &
  1314. server). If you want to try it, a demo version is available on
  1315. sumex-aim.stanford.edu as "/info-mac/demo/asc-ctb-tools.hqx". You may try
  1316. it with our application "5PM", also available at the same place.
  1317.  
  1318. Piet Saslawsky
  1319.  
  1320. +-------------------------------------+-------------------------------+
  1321. | Advanced Software Concepts (France) | Open Connect Systems (Dallas) |
  1322. | email: adv.soft@applelink.apple.com | email: psaslaw@oc.com         |
  1323. | voice: (33) 93 24 76 00             | voice: (214) 888 0658         |
  1324. +-------------------------------------+-------------------------------+
  1325.  
  1326. +++++++++++++++++++++++++++
  1327.  
  1328. From: scott@mcl.ucsb.edu (Adm Scott Bronson)
  1329. Date: 6 Dec 92 06:46:52 GMT
  1330.  
  1331. In article <sdorner-241192101852@0.0.0.0>, sdorner@qualcomm.com (Steve Dorner) writes:
  1332. >
  1333. >Using the CTB will be EASIER, not harder, than driving the serial ports
  1334. >yourself, unless you intend to be very, very simple-minded about it.
  1335.  
  1336. Two months ago, I put the finishing touches on an application whose sole
  1337. purpose was to log into a well-known incredibly hard-to-use database and
  1338. make it a lot easier to download info.  To save others from going through
  1339. the agony that I did, I'll tell you briefly what happened.
  1340.  
  1341. My colleage/friend of mine and I accepted the contract to build this.
  1342. To help draw up specs for this project, I bought Inside the Mac Comm
  1343. Toolbox and saw how incredibly easy it was to add communications to
  1344. an app.  Besides, since we were going to use the CTB, the user could
  1345. telnet to the database, or some other nifty way of connectiong that may
  1346. be available in the future.
  1347.  
  1348. Our first problem was how incredibly long it takes for the Apple Modem
  1349. Tool to synchronously connect to a modem.  I performed a huge kludge/
  1350. workaround making it look like we were open and transferring data
  1351. when the connection was still being opened asynchronously (our clients
  1352. would not stand for taking that long simply to connect to the database--
  1353. after all, no other comm program takes that long).
  1354.  
  1355. Then, wes noticed that the error code returned by a tool often failed
  1356. to indicate what sort of error actually happened.  In fact, they were
  1357. downright misleading.  When you get cmNotOpen, cmUserCancel, cmNotSupported,
  1358. or cmNoRequestPending, don't tear your hair out like I did if the error
  1359. does not have anything to do with the error code.
  1360.  
  1361. It is a minor annoyance to have to reboot after every ExitToShell.  This
  1362. can make debugging sessions looong and arduous.  I devised my own
  1363. workaround, but this behavior left a bad taste in my mouth.  It looks
  1364. to me like sloppy programming.  I mean, no other Macintosh managers
  1365. (that I know about) fail so gracelessly on an ES.
  1366.  
  1367. The Comm Toolbox allocates about 200K in handles whenever it opens
  1368. a connection, and locks them down smack dab in the middle of your
  1369. heap.  Makes no effort to HLockHi or any sort of courtesly like that.
  1370. This was a MAJOR problem for us because we were doing a lot of
  1371. loading and purging of scripts and windows, and we would run into
  1372. a ton of out of memory errors even though there was plenty of free
  1373. memory--the comm toolbox was just fragmenting the heck out of it.
  1374.  
  1375. Finally, the Apple Modem Tool would freeze occasionally during a heavy
  1376. transfer using a Teleport 2400/Sendfax modem.  The Teleport would show
  1377. data still coming in, the computer would still operate fine, but the
  1378. tool would just quit sending the data to us.  This was the straw that
  1379. broke the camel's back.
  1380.  
  1381. Two days before a major demo of the product, we were still getting these
  1382. freezes.  We tried the Hayes Modem tool, but there was some problem
  1383. there (I forget what it was) and the CCL Modem Tool, but that didn't
  1384. allow a 7-bit data path.  I saved the day (no applause, please) by
  1385. spending two days and nights putting AT commands on top of the Serial
  1386. Tool, and surprisingly getting it to work.  The demo went without a hitch.
  1387.  
  1388. Fully fed up, I rewrote our app almost from the ground up, writing
  1389. the CTB clean out of it.  Turns out it took a *shorter* time to write 
  1390. nd debug routines to talk directly to the serial port, including
  1391. searching and acting on the incoming data stream, than it did to
  1392. write the CTB routines.  We were now opening the connection in a
  1393. reasonable amount of time, our error messages were totally accurate,
  1394. and our app was down to needing 150K of memory.
  1395.  
  1396. So, unless you've got memory and time to spare, and unless you're
  1397. programming for a vertical market where error messages don't have to
  1398. matter, be wary of the CTB.  It may have improved since my experience
  1399. with it and more reliable tools may have come out--I haven't used it
  1400. since we put the finishing touches on this contract.  But, make your
  1401. decision carefully--it may end up costing as dearly as it did us.
  1402.  
  1403.     - Scott
  1404.  
  1405. ObHack: When converting the Serial Tool to drive modems, we needed
  1406. to put our interface on top of its configuration dialog.  Using CM
  1407. custom choose, I was able to hide some items of the dialog and move
  1408. and resize others until it looked exactly like the dialog we wanted.
  1409. Really made me glad I was programming a Macintosh; without DITLs, we
  1410. would have been sunk.
  1411.  
  1412. PS: if you would like more info or clarification, please write.  I
  1413. don't hate the comm toolbox.  I just had a really hard time getting
  1414. it to do what I wanted, and found in the end that just doing it using
  1415. the serial calls was easier in the end.
  1416.  
  1417. +++++++++++++++++++++++++++
  1418.  
  1419. From: edan@netcom.com (Edan Shalev)
  1420. Date: 7 Dec 92 07:58:28 GMT
  1421. Organization: Netcom - Online Communication Services  (408 241-9760 guest)
  1422.  
  1423. Im a fairly new mac programmer and I have a question regarding
  1424. the CommToolBox...  Im writing a term program which needs to
  1425. search incoming data and handle it accordingly.  The searching part
  1426. wasnt a problem, i just used CMADDSEARCH and checked refNum's 
  1427. in the CMSEARCHCALLBACK.  But what I need is the data that 
  1428. immediatly follows the match in the search.
  1429.  
  1430. example:
  1431.  
  1432. add a search for "\pabc"
  1433. send "abc123" to the terminal
  1434. 'abc' will match, now read in '123'
  1435.  
  1436. CMSEARCHCALLBACK(ConnHandle,Ptr,long)
  1437. will give me a Ptr to the last byte in the found search...
  1438. so i figured I could do this..
  1439.  
  1440. ((char *)Ptr)[0] = lastbyte....
  1441. ((char *)Ptr)[1] = should equal the next byte (in this case '1')
  1442.  
  1443. but it doesnt, the search seems be done byte by byte so it doesnt
  1444. contain any other data.  How should I go about retrieving the '123'
  1445. following the search pattern 'abc'?  should I do another CMREAD in
  1446. the callback routine? if so how do i implement it?
  1447.  
  1448. thanks alot!
  1449.  
  1450. - -Edan
  1451.  
  1452. +++++++++++++++++++++++++++
  1453.  
  1454. From: schulte@klin.far.ruu.nl (Bas Schulte, Spider)
  1455. Date: 7 Dec 92 19:35:50 GMT
  1456. Organization: UTexas Mail-to-News Gateway
  1457.  
  1458. Dear Scott,
  1459.  
  1460. wauw, your posting about the CTB really struck me. About a week
  1461. ago, I posted a message describing my experiences with the CTB,
  1462. and they're not good!
  1463.  
  1464.  
  1465. > To help draw up specs for this project, I bought Inside the
  1466. > Mac Comm Toolbox and saw how incredibly easy it was to add
  1467. > communications to an app.  
  1468.  
  1469. That's what I felt too. I had even used the CTB already in some
  1470. simple projects, e.g. a graphical app that would dial out to a
  1471. Unix host and fetch my mail there. Just fun and play, but I
  1472. hadn't had any problems whatsoever.
  1473.  
  1474. For my current project, I needed to write a host-like system
  1475. and clients that talk to each other over a connection.
  1476.  
  1477.  
  1478. > Besides, since we were going to
  1479. > use the CTB, the user could telnet to the database, or some
  1480. > other nifty way of connectiong that may be available in the
  1481. > future.
  1482.  
  1483. Yes, that was a real strong point in my motivation for choosing
  1484. the CTB. I could offer immediate connectivity with ISDN and
  1485. tcp/ip. That was a great pro.
  1486.  
  1487.  
  1488. > Then, wes noticed that the error code returned by a tool
  1489. > often failed to indicate what sort of error actually happened.
  1490.  
  1491. This really drove me crazy at times! The connection should
  1492. offer some morde descriptive error information. I believe the
  1493. FileTransfer tools do offer a routine for this. Haven't checked
  1494. it though. I also feel that when you want to use a connection
  1495. in a cmQuiet+cmNoMenus mode (I was using faceless bg apps), the
  1496. app should be able to get some info on what's going on. My
  1497. problem was that the AMT just wouldn't start answering the
  1498. phone! I couldn't figure out what I was doing wrong. I used
  1499. cmopen asynchronously, hoping the completion routine would be
  1500. called whenever there was a dail-in attempt. Nope. It just
  1501. refused to answer! Coincidentally, while cmopen was running, I
  1502. tried a WaitNextEvent sleepval of zero instead of 30, and guess
  1503. what? It worked! Now tell me the logic here!
  1504.  
  1505.  
  1506. > It is a minor annoyance to have to reboot after every ExitToShell.
  1507. > This can make debugging sessions looong and arduous.
  1508.  
  1509. That was a problem with older versions of the CTB, newer ones
  1510. no longer have this problem.
  1511.  
  1512.  
  1513. > Finally, the Apple Modem Tool would freeze occasionally during
  1514. > a heavy transfer using a Teleport 2400/Sendfax modem.
  1515.  
  1516. I didn't have problems at 2400 baud, but I could forget about
  1517. v32bis. Filetransfers _always_ failed, unless I used 128 byte
  1518. blocks xmodem, of which throughput was _bad_.
  1519.  
  1520.  
  1521. > Two days before a major demo of the product, we were still
  1522. > getting these freezes.  
  1523.  
  1524. Tell me about it: I was having these problems the night before
  1525. the demo! At the very last minute we used another app for the
  1526. actual modem-ing/transferring! Looked a bit clumsy indeed.
  1527.  
  1528.  
  1529. > We tried the Hayes Modem tool, but there was some problem
  1530. > there
  1531.  
  1532. HMT 1.0.2 doesn't support asynchronous open's.
  1533.  
  1534.  
  1535. > be wary of the CTB.  It may have improved since my experience
  1536. > with it and more reliable tools may have come out
  1537.  
  1538. I think your efforts are a while back, so I do think it has
  1539. improved. AMT 1.1.1 handles highspeed modems better (well, they
  1540. connect at an acceptable speed...), and you can ES safely.
  1541. Haven't looked into memory consumption though (not a very
  1542. important issue in my project).
  1543.  
  1544.  
  1545. I also started to develop my own serial i/o, but after a few
  1546. hours sifting through IM 1-6, I felt really bad. I decided to
  1547. redesign my apps to normal apps (vs. bg apps), and let the
  1548. various tools display their dialogues to see what was going
  1549. wrong, and that gave me some more info, and at this moment it
  1550. seems to be going smoother. ISDN and tcp/ip connectivity is
  1551. such an important issue for me that I'll stay with the CTB,
  1552. despite all my problems, and no doubt my future problems.
  1553. Hopefully, when the CTB is integrated with the Entreprise
  1554. Toolbox it'll get better.
  1555.  
  1556. Best regards,
  1557.  
  1558. Bas A. Schulte
  1559. Creative Links
  1560.  
  1561. +++++++++++++++++++++++++++
  1562.  
  1563. From: mspace@netcom.com (Brian Hall)
  1564. Date: 8 Dec 92 21:23:00 GMT
  1565. Organization: Netcom - Online Communication Services  (408 241-9760 guest)
  1566.  
  1567. schulte@klin.far.ruu.nl (Bas Schulte, Spider) writes:
  1568. >> We tried the Hayes Modem tool, but there was some problem
  1569. >> there
  1570.  
  1571. >HMT 1.0.2 doesn't support asynchronous open's.
  1572.  
  1573. HMT 1.0.2 also calls setport (even if cmQuiet) which causes a crash
  1574. if you are a faceless bg app.  Hayes knows about this and hopefully will
  1575. release a version with that problem fixed.
  1576.  
  1577. - -- 
  1578.  
  1579.  \ | /   | Brian Hall                 mspace@netcom.com
  1580.  - : -   | Mark/Space Softworks       Applelink: markspace
  1581.   /|\    |                            America Online: MarkSpace
  1582.  |-+-|   |
  1583. /-\|/-\  | PUI: Programming Under the Influence.
  1584.  
  1585. +++++++++++++++++++++++++++
  1586.  
  1587. From: alexr@apple.com (Alexander M. Rosenberg)
  1588. Date: 9 Dec 92 23:50:42 GMT
  1589. Organization: Hackers Anonymous
  1590.  
  1591. In article <921208.083620.534@klin.far.ruu.nl> Bas Schulte,
  1592. schulte@klin.far.ruu.nl writes:
  1593. >> Then, wes noticed that the error code returned by a tool
  1594. >> often failed to indicate what sort of error actually happened.
  1595. >
  1596. >This really drove me crazy at times! The connection should
  1597. >offer some morde descriptive error information. I believe the
  1598. >FileTransfer tools do offer a routine for this. Haven't checked
  1599. >it though. I also feel that when you want to use a connection
  1600. >in a cmQuiet+cmNoMenus mode (I was using faceless bg apps), the
  1601. >app should be able to get some info on what's going on. My
  1602. >problem was that the AMT just wouldn't start answering the
  1603. >phone! I couldn't figure out what I was doing wrong. I used
  1604. >cmopen asynchronously, hoping the completion routine would be
  1605. >called whenever there was a dail-in attempt. Nope. It just
  1606. >refused to answer! Coincidentally, while cmopen was running, I
  1607. >tried a WaitNextEvent sleepval of zero instead of 30, and guess
  1608. >what? It worked! Now tell me the logic here!
  1609.  
  1610. Unfortunately, the Apple Modem Tool relies on idle messages to process an
  1611. async opne/listen. Unless it CMIdle is called often enough, it won't be
  1612. able to accomplish that within a timeout. This is near the top of the list
  1613. of things to change in the Apple Modem Tool.
  1614.  
  1615. >> Finally, the Apple Modem Tool would freeze occasionally during
  1616. >> a heavy transfer using a Teleport 2400/Sendfax modem.
  1617. >
  1618. >I didn't have problems at 2400 baud, but I could forget about
  1619. >v32bis. Filetransfers _always_ failed, unless I used 128 byte
  1620. >blocks xmodem, of which throughput was _bad_.
  1621.  
  1622. It would be a miracle if the 1.0.X version of the XMODEM Tool ever
  1623. transferred a file successfully.
  1624.  
  1625. >Hopefully, when the CTB is integrated with the Entreprise
  1626. >Toolbox it'll get better.
  1627.  
  1628. Enter...what?
  1629. - ---------------------------------------------------------------------------
  1630. - -  Alexander M. Rosenberg  - INTERNET: alexr@apple.com      - Yoyodyne    -
  1631. - -  330 Waverley St., Apt B - UUCP:ucbvax!apple!alexr        - Propulsion  -
  1632. - -  Palo Alto, CA 94301     -                                - Systems     -
  1633. - -  (415) 329-8463          - Nobody is my employer so       - :-)         -
  1634. - -  (408) 974-3110          - nobody cares what I say.       -             -
  1635.  
  1636. +++++++++++++++++++++++++++
  1637.  
  1638. From: sdorner@qualcomm.com (Steve Dorner)
  1639. Organization: Qualcomm, Inc.
  1640. Date: Thu, 10 Dec 1992 20:32:13 GMT
  1641.  
  1642. In article <scott.723624412@mcl>, scott@mcl.ucsb.edu (Adm Scott Bronson)
  1643. wrote:
  1644. > Our first problem was how incredibly long it takes for the Apple Modem
  1645. > Tool to synchronously connect to a modem.
  1646.  
  1647. Yes, it takes a while.  The Hayes Modem Tool is a little faster.  The HMT
  1648. is *much* faster on disconnect, which takes the AMT forever.
  1649.  
  1650. > Then, wes noticed that the error code returned by a tool often failed
  1651. > to indicate what sort of error actually happened.
  1652.  
  1653. This is true; error reporting is very poor back to the parent app. 
  1654. However, if you turn cmQuiet off, the tools I've used give reasonable
  1655. feedback.
  1656.  
  1657. > It is a minor annoyance to have to reboot after every ExitToShell.
  1658.  
  1659. Again, turning cmQuiet off makes this unnecessary; you get an "override"
  1660. button.
  1661.  
  1662. > The Comm Toolbox allocates about 200K in handles whenever it opens
  1663. > a connection, and locks them down smack dab in the middle of your
  1664. > heap.
  1665.  
  1666. That's not true, or at least not true all the time.  Eudora typically runs
  1667. in a 300K partition, and I'm darn sure that it doesn't have 200K to spare
  1668. for CTB use!  40K is more like it.  I've not paid attention to locking.
  1669.  
  1670. > Finally, the Apple Modem Tool would freeze occasionally during a heavy
  1671. > transfer using a Teleport 2400/Sendfax modem.
  1672.  
  1673. I haven't ever experienced anything of the kind.  This may simply have been
  1674. your bug.
  1675.  
  1676. > Fully fed up, I rewrote our app almost from the ground up, writing
  1677. > the CTB clean out of it.  Turns out it took a *shorter* time to write 
  1678.  
  1679. But now I want to use your program over TCP/IP.  Can I?  (No.)  Ditto for
  1680. ADSP.  Ditto for serial ports on NuBus cards or ADB (or are you cheating
  1681. and using a little of the CTB?).
  1682.  
  1683. > PS: if you would like more info or clarification, please write.  I
  1684. > don't hate the comm toolbox.
  1685.  
  1686. Personally, I *do* hate it.  Many of the points you raise are indeed valid.
  1687.  However, the darn thing is just too useful in spite of its flaws,
  1688. especially if you AREN'T writing custom single-purpose software, and don't
  1689. want to lock your users into one particular form of connection.  So I grin
  1690. and bear it.
  1691. - --
  1692. Steve Dorner, Qualcomm, Inc.
  1693. Why does Apple want to eliminate cheap MacTCP applications?
  1694.  
  1695. +++++++++++++++++++++++++++
  1696.  
  1697. From: mspace@netcom.com (Brian Hall)
  1698. Date: 10 Dec 92 22:58:26 GMT
  1699. Organization: Netcom - Online Communication Services  (408 241-9760 guest)
  1700.  
  1701. sdorner@qualcomm.com (Steve Dorner) writes:
  1702.  
  1703. >In article <scott.723624412@mcl>, scott@mcl.ucsb.edu (Adm Scott Bronson)
  1704. >wrote:
  1705. >> Our first problem was how incredibly long it takes for the Apple Modem
  1706. >> Tool to synchronously connect to a modem.
  1707.  
  1708. >Yes, it takes a while.  The Hayes Modem Tool is a little faster.  The HMT
  1709. >is *much* faster on disconnect, which takes the AMT forever.
  1710.  
  1711. By observation, the HMT also seems to be able to process reads/writes
  1712. faster.  I did not do any benchmarks, but I noticed a visible difference
  1713. when I switched from HMT to AMT (I wanted to be able to do asynch opens)
  1714.  
  1715. - -- 
  1716.  
  1717.  \ | /   | Brian Hall                 mspace@netcom.com
  1718.  - : -   | Mark/Space Softworks       Applelink: markspace
  1719.   /|\    |                            America Online: MarkSpace
  1720.  |-+-|   |
  1721. /-\|/-\  | PUI: Programming Under the Influence.
  1722.  
  1723. ---------------------------
  1724.  
  1725. End of C.S.M.P. Digest
  1726. **********************
  1727.